<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
<script src="../AngularJS/angular-1.5.0/angular.min.js"></script>
		<title></title>
	</head>
	<body ng-app="myapp">
		<div ng-controller="myctrl">
			<hello></hello>
			<hello></hello>
			<hello></hello>
			<hello></hello>
		</div>
<script>
	var app = angular.module("myapp",[]);
	app.controller("myctrl",function($scope){
		 $scope.sayHello=function(name){
		 	alert("hello"+name);
		 }
	});
	app.directive("hello",function(){
		return{
//			scope:{},          //独立scope
			restrict:"AE",
//			scope:{
//				greet:"&",
//			},
			replace:true,
			template:'<div><input type="text" ng-model="username"/>{{username}}</div>'
					
						
		}
	});
</script>
	</body>
</html>
